﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Yaml.Grammar
{
	public enum NodeType {
		Unknown,
		Scalar,
		Mapping,
		Sequence,
	}
	public partial class MappingEntry
	{
		private DataItem _key;
		private DataItem _value;
		
		public DataItem Value {
			get { return _value; }
			set { _value = value; }
		}
		
		public DataItem Key {
			get { return this._key;}
			set { this._key = value;}
		}



		public NodeType KeyType {
			get {
				if(Key.GetType().ToString() == "Yaml.Grammar.Scalar") return NodeType.Scalar;
				if(Key.GetType().ToString() == "Yaml.Grammar.Mapping") return NodeType.Mapping;
				if(Key.GetType().ToString() == "Yaml.Grammar.Sequence") return NodeType.Sequence;
				return NodeType.Unknown;
			}
		}
		
		public NodeType ValueType {
			get {
				if(Value.GetType().ToString() == "Yaml.Grammar.Scalar") return NodeType.Scalar;
				if(Value.GetType().ToString() == "Yaml.Grammar.Mapping") return NodeType.Mapping;
				if(Value.GetType().ToString() == "Yaml.Grammar.Sequence") return NodeType.Sequence;
				return NodeType.Unknown;
			}
		}
	}
}
